#include "VoiceEngineObserverImpl.h"


VoiceEngineObserverImpl::VoiceEngineObserverImpl(void)
{
	m_mid_CallbackOnError = 0;
}


VoiceEngineObserverImpl::~VoiceEngineObserverImpl(void)
{
}

bool VoiceEngineObserverImpl::init_jni(JNIEnv* env)
{
	bool result = false;

	do 
	{
		m_mid_CallbackOnError = (env)->GetMethodID(m_cls, "callbackOnError", "(II)V");
		if(!m_mid_CallbackOnError)
			break;

		result = true;

	} while (false);

	return result;
}

void VoiceEngineObserverImpl::CallbackOnError(const int channel, const int errCode)
{
	JNIEnv* env = 0;

	if(before(&env))
	{
		(env)->CallVoidMethod(m_obj, m_mid_CallbackOnError, channel, errCode);

		after(env);
	}
}